import { request, obtain } from '@utils/request'
const fetchCate = (params = {}) => request.get('/phone/salesThings', { params: params })

const fetchCateBanner = (params = {}) => request.get('phone/getIconfont', { params })
const fetchCateLocal = (params = {}) => request.get('phone/cateList', { params })
const getDetail = (id) => request.get(`phone/getDetail?id=${id}`)
const obtainapi = () => obtain.get('/shop/goods/category/all')
const loginEnter = (userinfo) => request.post('/phone/login', userinfo)
const getInfo = () => request.post('phone/detailInfo')
const addUser = (userdata) => request.post('/users/register', userdata)
const Addaddress = (data) => request.post('/phone/Addaddress', data)
const getAddress = () => request.post('/phone/getAddress')
const getOneAddress = (id) => request.get(`phone/GetOneaddress?id=${id}`)

const updateAddress = (data) => request.post('/phone/Updateaddress', data)
const delOneAddress = (id) => request.post('/phone/Deladdress', { params: { id } })
const updateOrder = (data) => request.post('/phone/UpdataOrder', data)
const searchData = (data) => request.get(`/phone/SearChData?query=${data}`,)
export {
    fetchCate,
    fetchCateBanner,
    fetchCateLocal,
    getDetail,
    obtainapi,
    loginEnter,
    getInfo,
    addUser,
    Addaddress,
    getAddress,
    getOneAddress,
    updateAddress,
    delOneAddress,
    updateOrder,
    searchData
}